use i8office
go

if (exists (select * from sys.objects where name = 'proc_wkf_doc'))
	drop proc proc_wkf_doc
go
create proc proc_wkf_doc(
	@DocID nvarchar(36),
	@MessageID nvarchar(36),
	@DocHelperID nvarchar(36),
	@TemplateMessageID nvarchar(36)
)
as
	INSERT INTO [dbo].[WKF_Doc]
           ([DocID]
           ,[MessageID]
           ,[DocName]
           ,[DocType]
           ,[DocDescr]
           ,[DocHelperID]
           ,[DocContent]
           ,[SortNo]
           ,[CreateTime]
           ,[UpdateTime])
     SELECT
           @DocID
           ,@MessageID
           ,[DocName]
           ,[DocType]
           ,[DocDescr]
           ,@DocHelperID
           ,[DocContent]
           ,[SortNo]
           ,GETDATE()
           ,GETDATE()
	FROM [dbo].[WKF_Doc]
	WHERE MessageID = @TemplateMessageID